package top.noteday.controller;

import entity.form.FormDto;
import entity.form.FormVo;
import entity.result.EntityResult;
import entity.value.Value;
import entity.value.ValueDto;
import entity.value.ValueVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.noteday.provider.form.FormService;
import top.noteday.provider.value.ValueService;
import utils.common.StrUtil;

import java.util.Date;

@RestController
@RequestMapping(value = "/backstage/value")
public class ValueController {
    private final Logger LOGGER = LoggerFactory.getLogger(ValueController.class);

    @Autowired
    private ValueService valueService;

    /**
     * 获取详情
     * {
     * 	"id":3
     * }
     */
    @PostMapping("/getFormValue")
    public EntityResult<ValueDto> getFormValue(@RequestBody ValueVo vo) {
        LOGGER.info("获取详情{} = ", vo);

        StrUtil.paramIsCorrect(StrUtil.isNotEmpty(vo.getId()), "主键不能为空");

        return valueService.getFormValue(vo);
    }
}
